<template>
	<view class="vote_box">
		<view class="text-c" v-if="">
			<image v-if="info.result_icon" class="votefinish" :src="info.img_url+info.result_icon"></image>
			<view class="votefinish_text">
				<text>{{info.result_desc?info.result_desc:'谢谢参与'}}</text>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		toFeedback,
		getSurvey
	} from '@/api/motortime.js';
	export default {
		data() {
			return {
				statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
				pageTop: uni.getSystemInfoSync().statusBarHeight + 52,
				showFinish: true,
				feedback: '',
				info: ''
			}
		},
		onLoad(options) {
			this.id = options.scene
		},
		onShow() {
			var that = this
			if (uni.getStorageSync('access_token')) {
				setTimeout(function() {
					that.getSurvey()
				}, 100)
			} else {
				uni.navigateTo({
					url: '/pages/login/login'
				})
			}
		},
		methods: {
			getSurvey() {
				getSurvey(this.id).then(res => {
					if (res.state == 1) {
						this.info = res.data
						uni.setNavigationBarTitle({
							title: res.data.top ? res.data.top : '问卷',
						})
						var params = {
							event_code: res.data.top ? res.data.top : '问卷',
							event_id: this.id,
							title: this.info.title ? this.info.title : '问卷',
							value: '',
							path: 'pages/questionnaireok/questionnaireok',
							user_id: uni.getStorageSync('userinfo') ? uni.getStorageSync('userinfo').user_id :
								0,
						}
						app.BurialPoint(params)
					}
				})
			},
			backPage() {
				uni.navigateBack({
					delta: 1
				})
			},
			Feedback() {
				this.showFinish = false
			},
			bindTextArea: function(e) {
				this.feedback = e.detail.value
			},
			toFeedback() {
				if (this.feedback == '') {
					uni.showToast({
						title: '请填写反馈内容',
						icon: 'none',
						duration: 1500
					})
				} else {
					var params = {
						surveyed_id: parseInt(this.id),
						feedback: this.feedback
					}
					toFeedback(params).then(res => {
						if (res.state == 1) {
							uni.navigateTo({
								url: '/pages/votefinish/votefinish?scene=' + this.id
							})
						}
					})
				}
			}
		},
		onShareAppMessage(res) {
			app.getShareTask()
		},
	}
</script>

<style lang="scss">
	.vote_box {
		height: 100vh;
		overflow: hidden;
		background-color: #F7F7F7;

		.top_navbar {
			position: fixed;
			top: 0;
			left: 0;
			right: 0;

			.topImg_box {
				width: 100%;
				height: 52px;
				background-size: 100% 52px;
				font-size: 32rpx;
				font-weight: 500;
				display: flex;
				align-items: center;
				justify-content: center;
				position: relative;

				.top_back {
					position: absolute;
					left: 10rpx;
					width: 30rpx;
					height: 30rpx;
					float: left;
					padding: 30rpx;
				}
			}
		}

		.votefinish {
			width: 100rpx;
			height: 100rpx;
			margin-top: 30%;
			border-radius: 50px;
		}

		.votefinish_text {
			font-size: 32rpx;
			color: #3A3A3A;
			text-align: center;
			font-weight: 500;
			margin-top: 30rpx;
		}


		.votefinish_btn {
			color: #6D7278;
			font-size: 28rpx;
			text-align: center;
			margin: 0 25%;
			margin-top: 30%;
			padding: 25rpx 0;
			border: 4rpx solid #605c6b;
		}

		.text_box {
			padding: 40rpx;

			.text_input {
				padding: 30rpx;
				margin-top: 50rpx;
				background-color: #FFFFFF;
				height: 480rpx;
				background: #FDFFFF;
				border: 1pt solid #C8C8C8;
				font-size: 24rpx;
			}

			.submit_btn {
				position: fixed;
				bottom: 7%;
				left: 0;
				right: 0;
				margin: 0 auto;
				color: #FFFFFF;
				text-align: center;
				width: 350rpx;
				padding: 25rpx 0;
				background: #605c6b;
			}
		}


	}
</style>